package com.shaw.mybatisx.plugin;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by asus on 2018/4/10.
 */
public class InterceptorChain {
    private List<Interceptor> interceptorList = new ArrayList<Interceptor>();

    public void addInterception(Interceptor interceptor){
        this.interceptorList.add(interceptor);
    }

    public Object plginAll(Object target){
        for(Interceptor interceptor:interceptorList){
            target = interceptor.plugin(target);
        }
        return target;
    }
}
